<?php
namespace Utuo\DistributionShopScore;

use Utuo\DistributionShopScore\AbstractScore;
use Utuo\SystemInfo;

/**
 * 填资料返积分
 * @author song
 */
class FirstSubscribeScore extends AbstractScore {
    
    /**
     * 构造
     * @param array $config 购物返积分配置信息
     *  // 基础参数 
     *  // ... ...
     *  // 驱动参数配置(用于参数重新赋值)
     *  'tag' => '',
     *  'driverConfig' => array(),
     */
	public function __construct( $config ) {
		parent::__construct( $config );
	}
	
	/**
	 * 执行积分处理
	 * @see \Utuo\DistributionShopScore\AbstractScore::exec()
	 */
	public function _exec( $execParams ) {
	    /* 传递参数中取积的分数 */
		$score = isset($execParams['score']) ? $execParams['score'] : null;
		/* 驱动中取积的分数 */
	    if ( $score == null && !empty($this->driverConfig['reward_score']) ) {
	       $score = (isset($this->driverConfig['reward_score']) ? $this->driverConfig['reward_score'] : null);
	    }
	    if ( $score*1 ) {
	        $execParams['score'] = $score;
	        return $this->changeScore( $execParams );
	    } else {
	        return false;
	    }
	}
	
	/**
	 * 积分变化记录(从表记录)
	 * @param array $wparams
	 */
	protected function extendsRecored( $execParams ) {
	    
	}
	
}
